package com.zhang.designmode.wangzheng_design_mode.zhuangtaiji;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * @Author: zxz
 * @DateTime: 2022/3/3 18:07
 * @Description: TODO
 */
public class Step {
    private Status status;
    private List<OperatorStatus> operatorStatusList;

    public Status getStatus() {
        return status;
    }

    public Step(Status status, OperatorStatus... operatorStatus) {
        List<OperatorStatus> operatorStatuses = Arrays.asList(operatorStatus);
        this.status = status;
        this.operatorStatusList = operatorStatuses;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Step step = (Step) o;
        return status == step.status;
    }

    @Override
    public int hashCode() {
        return Objects.hash(status);
    }

    public boolean isAllow(OperatorStatus operatorStatus){
        if (operatorStatusList.contains(operatorStatus)){
            return true;
        }else{
            return false;
        }
    }

}
